package cn.lyjuan.android.demofive.ui.slide.scroll;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import cn.lyjuan.android.demofive.R;

/**
 * Created by chad on 2016/4/17.
 */
public class ChildFragment extends Fragment
{
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
    {
        View view = inflater.inflate(R.layout.ui_scroll_drawer_first, container, false);

        TextView text = (TextView) view.findViewById(R.id.ui_scroll_drawer_first_text);
        text.setText(this.getActivity().getActionBar().getTitle());
        Button but = (Button) view.findViewById(R.id.ui_scroll_drawer_first_but);
        but.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                Log.w(ChildFragment.class.getSimpleName(), "but onclick");
//                drawer.openDrawer(Gravity.CENTER);
                ((OpenDrawerCallback) ChildFragment.this.getActivity()).openDrawer();
            }
        });

        return view;
    }

    public interface OpenDrawerCallback
    {
        void openDrawer();
    }
}
